/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rdr.xfiles.model.filesystem;

import java.io.File;
import java.util.List;

/**
 *
 * @author ruanor
 */
public class DirectoryData extends FileSystemEntity{
    
    private DirectoryData parent;
    private List<DirectoryData> subDirectories;
    private List<FileData> files;

    DirectoryData(File file) {
        super(file);
        
        String strParent = file.getParent();
        
        if(strParent == null)
            this.parent = null;
        
        updateContent();
    }
    
    /**
     * @return the subDirectories
     */
    public List<DirectoryData> getSubDirectories() {
        return subDirectories;
    }

    /**
     * @return the files
     */
    public List<FileData> getFiles() {
        return files;
    }
    
    public boolean isEmpty()
    {
        if(files != null)
            if(files.size() != 0)
                return false;
        
        if(subDirectories != null)
            if(subDirectories.size() != 0)
                return false;
        
        return true;
    }
    
    public boolean isRoot()
    {
        if(parent == null)
            return true;
        
        return false;
    }

    public String getFullPath()
    {
        if(parent == null)
            return this.getName();            
        
        return parent.getFullPath() + "//" + this.getName();
    }
    
    private void updateContent() {
           
    }
}
